package com.jzhao.gper.strategy;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class CoverpageStrategyFacory {

    public static Map<String,ICoverpageManager> COVERPAGES = new HashMap<String,ICoverpageManager>();

    private interface COVERPAGE_TYPES {
        String PRIMARY_MARKET = "1";
        String SEMI_MARKET = "2";
        String STOCK = "3";
        String BONDS = "4";
        String FUND = "5";
        String REAL_ESTATE = "6";
    }

    static{
        COVERPAGES.put(COVERPAGE_TYPES.PRIMARY_MARKET,new CoverpagePrimaryMarketManager());
        COVERPAGES.put(COVERPAGE_TYPES.SEMI_MARKET,new CoverpageSemiMarketManager());
        COVERPAGES.put(COVERPAGE_TYPES.STOCK,new CoverpageStockManager());
        COVERPAGES.put(COVERPAGE_TYPES.BONDS,new CoverpageBondsManager());
        COVERPAGES.put(COVERPAGE_TYPES.FUND,new CoverpageFundManager());
        COVERPAGES.put(COVERPAGE_TYPES.REAL_ESTATE,new CoverpageRealEstateManager());
    }

    private CoverpageStrategyFacory(){};

    public static ICoverpageManager getCoverpageManager(String coverpageType){
        ICoverpageManager coverpageManager=  COVERPAGES.get(coverpageType);
        return coverpageManager!=null?coverpageManager:COVERPAGES.get(COVERPAGE_TYPES.PRIMARY_MARKET);
    }

    public static Set<String> getCoverpageTypes(){
        return COVERPAGES.keySet();
    }
}
